﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;

namespace FCS.Emulator
{
    public class UIInteger
    {
        private Control _integerControl;

        public UIInteger(TextBox tb)
        {
            _integerControl = tb;
        }

        public void SetState(int newState)
        {
            if (_integerControl is TextBox)
            {
                ((TextBox)_integerControl).Text = newState.ToString();
            }
        }

        public int GetState()
        {
            if (_integerControl is TextBox)
            {
                return Int32.Parse(((TextBox)_integerControl).Text);
            }
            else
            {
                throw new InvalidOperationException("Tried to perform GetState on an object of unsupported type.");
            }
        }
    }
}
